#include <stdio.h>
#include <stdlib.h>

struct date
{
    unsigned char day;
    unsigned char month;
    unsigned short year;
};

void update(struct date * pdate)
{
    unsigned char day_list[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    if(pdate->year%100)
    {
        if(!(pdate->year%400))day_list[1]++;
    }
    else
    {
        if(!(pdate->year%4))day_list[1]++;
    }
    pdate->day = (pdate->day + 1) % day_list[pdate->month - 1];
    if (pdate->day == 1)pdate->month = (pdate->month + 1) % 12;
    if (!pdate->month)pdate->month = 12;
    if (pdate->day == 1 && pdate->month == 1)pdate->year++;
}

int main()
{
    struct date date_data = {
        .day = 31,
        .month = 12,
        .year = 2010
    };
    update(&date_data);
    printf("day:%d,month:%d,year:%d\n", date_data.day, date_data.month, date_data.year);
}